#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<string>

using namespace std;

class string

{

public:

	string(const char* str = "")
	{
		_size = strlen(str);
		_capacity = _size;

		_str = new char[_capacity + 1];
		strcpy(_str, str);
	}

	string(const string& s)
	{
		_str = new char[s._capacity + 1];
		strcpy(_str, s._str);
		_size = s._size;
		_capacity = s._capacity;
	}

	string& operator=(const string& s)
	{
		if (this->_str != s._str)
		{
			delete[] _str;

			_str = new char[s._capacity + 1];
			strcpy(_str, s._str);
			_size = s._size;
			_capacity = s._capacity;
		}
	}

	~string()
	{
		if (_str)
		{
			delete[] _str;
			_str = nullptr;
			_size = _capacity = 0;

		}
	}

private:

	char* _str;
	size_t _size;
	size_t _capacity;

};